<template>
	<view>
		<view class="notice_box" v-for="(item,index) in noticeList" v-if="noticeList.length>0">
			<view class="name">{{item.articleTitle}}</view>
			<view class="detail" v-html="item.articleContent"></view>
			<view class="time">{{$u.timeFormat(item.createTime, 'yyyy年mm月dd日 hh:MM')}}</view>
		</view>
		<view v-if="noticeList.length==0" class="gg">
			暂无公告~~~
		</view>
	</view>
</template>

<script>
	import {selectNotice} from '../../api/user.js'
	export default{
		data(){
			return{
				noticeList:[],
				time:null,
				timestamp:'',
				num:0
			}
		},
		onLoad() {
			this.getNoticeList();
		},
		onReachBottom() {
			this.getNoticeList()
		},
		methods:{
			getNoticeList(){
				this.num++
				this.get(selectNotice,{pageSize:10,pageNum:this.num}).then(res=>{
					console.log(res)
					res.data.list.forEach(item=>{
						this.noticeList.push(item)
					})
				})
			}
		}
	}
</script>

<style>
	.gg{
		text-align: center;
		margin-top: 200rpx;
	}
	page{
		background: #F2F2F2;
	}
	.notice_box{
		width: 690rpx;
		background: #FFFFFF;
		border-radius: 12px;
		margin: 30rpx auto;
		padding: 20rpx;
	}
	.name{
		font-size: 32rpx;
		font-weight: 400;
		color: #333333;
	}
	.detail{
		font-size: 28rpx;
		font-weight: 300;
		color: #333333;
		margin: 20rpx 0;
		overflow: hidden;  
		text-overflow: ellipsis;  
		display: -webkit-box;  
		-webkit-line-clamp: 2;  
		-webkit-box-orient: vertical; 

	}
	.time{
		font-size: 24rpx;
		font-weight: 500;
		color: #333333;
	}
</style>
